BigDFT.Logfiles module

This module is useful to process a logfile of BigDFT run, in yaml format. It also provides some tools to extract typical informations about the run, like the energy, the eigenvalues and so on.

class Energies(filename, units='AU', disp=None, strict=True)[source]

Find the energy terms from a BigDFT logfile. May also accept malformed logfiles that are issued, for instance, from a badly terminated run that had I/O error.

Parameters
  • filename (str) – path of the logfile

  • units (str) – may be ‘AU’ or ‘kcal/mol’

  • disp (float) – dispersion energy (will be added to the total energy)

  • strict (bool) – assume a well-behaved logfile

property to_dict
class Logfile(*args, **kwargs)[source]

Import a Logfile from a filename in yaml format, a list of filenames, an archive (compressed tar file), a dictionary or a list of dictionaries.

Parameters
  • *args – sequence of logfiles to be parsed. If it is longer than one item, the logfiles are considered as belonging to the same run.

  • **kwargs

    describes how the data can be read. Keywords can be:

    • archive: name of the archive from which retrieve the logfiles.

    • member: name of the logfile within the archive. If absent, all the

      files of the archive will be considered as args.

    • label: the label of the logfile instance

    • dictionary: parsed logfile given as a dictionary,

      serialization of the yaml logfile

Example

>>> l = Logfile('one.yaml','two.yaml')
>>> l = Logfile(archive='calc.tgz')
>>> l = Logfile(archive='calc.tgz',member='one.yaml')
>>> l = Logfile(dictionary=dict1)
>>> l = Logfile(dictionary=[dict1, dict2])

Todo

Document the automatically generated attributes, perhaps via an inner function in futile python module

geopt_plot()[source]

For a set of logfiles construct the convergence plot if available. Plot the Maximum value of the forces against the difference between the minimum value of the energy and the energy of the iteration. Also an errorbar is given indicating the noise on the forces for a given point. Show the plot as per plt.show() with matplotlib.pyplots as plt

Example
>>> tt=Logfile('log-with-geometry-optimization.yaml')
>>> tt.geopt_plot()
get_brillouin_zone()[source]

Return an instance of the BrillouinZone class, useful for band structure. :returns: Brillouin Zone of the logfile :rtype: BigDFT.BZ.BrillouinZone

get_dos(**kwargs)[source]

Get the density of states from the logfile.

Fill a py:class:~BigDFT.DoS.DoS class object with the information which is stored in this logfile.

Parameters

**kwargs – Keyword Arguments of the py:class:~BigDFT.DoS.DoS class.

Returns

class instance. Filled with bandarrays and

fermi_level.

Return type

BigDFT.DoS.DoS

label

Label of the Logfile instance

srcdir

Absolute path of the directory of logfile

wfn_plot()[source]

Plot the wavefunction convergence. :Example:

>>> tt=Logfile('log-with-wfn-optimization.yaml',label='a label')
>>> tt.wfn_plot()
find_iterations(log)[source]

Identify the different block of the iterations of the wavefunctions optimization.

Todo

Should be generalized and checked for mixing calculation and O(N) logfiles

Parameters

log (dictionary) – logfile load

Returns

wavefunction residue per iterations, per each subspace diagonalization

Return type

numpy array of rank two

get_logs(files)[source]

Return a list of loaded logfiles from files, which is a list of paths leading to logfiles.

Args:

Parameters

files – List of filenames indicating the logfiles

Returns

List of Logfile instances associated to filename

plot_wfn_convergence(wfn_it, gnrm_cv, label=None)[source]

Plot the convergence of the wavefunction coming from the find_iterations function. Cumulates the plot in matplotlib.pyplot module

Parameters
  • wfn_it – list coming from find_iterations()

  • gnrm_cv – convergence criterion for the residue of the wfn_it list

  • label – label for the given plot